package top.huhuiyu.springboot2.entity;

public class BaseResult {
  private int code;
  private String message;
  private boolean success;

  public static BaseResult ok(String message) {
    BaseResult result = new BaseResult();
    result.setCode(200);
    result.setSuccess(true);
    result.setMessage(message);
    return result;
  }

  public static BaseResult fail(String message) {
    BaseResult result = new BaseResult();
    result.setCode(500);
    result.setSuccess(false);
    result.setMessage(message);
    return result;
  }


  @Override
  public String toString() {
    return "BaseResult{" + "code=" + code + ", message='" + message + '\'' + ", success=" + success + '}';
  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public boolean isSuccess() {
    return success;
  }

  public void setSuccess(boolean success) {
    this.success = success;
  }
}
